package cn.zwxky.android.staff.Jurisdiction.Marketplace;

import android.content.Context;
import android.view.View;

import com.zgscwjm.lsfbbasetemplate.Event.LsfbEvent;
import com.zgscwjm.lsfbbasetemplate.adapter.CommonRecycAdapter;
import com.zgscwjm.lsfbbasetemplate.adapter.ViewHolderRecyc;

import java.util.List;

import cn.zwxky.android.staff.R;
import cn.zwxky.android.staff.Utils.URLString;

/**
 * Created by Administrator on 2017/4/7 0007.
 */

public class TaskApproveListAdapter extends CommonRecycAdapter<TaskApproveListBean.ListBean> {

    public TaskApproveListAdapter(Context context, List<TaskApproveListBean.ListBean> list, int layoutId) {
        super(context, list, layoutId);
    }

    @Override
    public void convert(ViewHolderRecyc holder, final TaskApproveListBean.ListBean model) {
        holder.setImg(R.id.aty_img_head, URLString.IMG_URL+model.getImg(),R.mipmap.img_my_details_head);
        holder.setText(R.id.aty_text_name,model.getName());
        holder.setText(R.id.aty_text_phone,model.getTel());
        holder.setText(R.id.aty_text_gongsi,model.getCompany());
        holder.setText(R.id.aty_text_title,model.getProname());
        if (model.getContent().isEmpty()){
            holder.setVisible(R.id.aty_text_beizhu,false);
        }else {
            holder.setVisible(R.id.aty_text_beizhu,true);
            holder.setText(R.id.aty_text_beizhu, model.getContent());
        }
        holder.setText(R.id.aty_text_type,model.getCla_name());

        if (model.getStatus().equals("4")){
            holder.setOnclick(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    TaskApproveClickEvent2 event=new TaskApproveClickEvent2();
                    event.setData(model.getId());
                    LsfbEvent.getInstantiation().post(event);
                }
            });
        }else {
            holder.setOnclick(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    TaskApproveClickEvent event=new TaskApproveClickEvent();
                    event.setData(model.getId());
                    LsfbEvent.getInstantiation().post(event);
                }
            });
        }

    }
}
